home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
United Public Domain Gold 4
/
United Public Domain Gold 4.iso
/
fredfish
/
ff.0013.dms
/
ff.0013.adf
/
Eliza.abc
< prev
next >
Wrap
Text File
|
1986-02-21
|
8KB
|
213 lines
10 'DEF SEG=&H40:POKE &H17, (PEEK(&H17) AND &HFFBF) +64:DEF SEG=&HB000:POKE 3998,24
20 CLS
30 ' ELIZA/DOCTOR
40 ' CREATED BY JOESEPH WEIZENBAUM
50 ' THIS VERSION BY JEFF SHRAGER
60 ' EDITED AND MODIFIED FOR IBM-PC BASICA A BY WILBUR STREETT
70 ' 1806 PITNEY STREET, OCEAN, NJ, 07712, 531-3790
80 '
90 ' ----------INITIALAZATION-----------
100 DIM C$(72),I$(72),K$(72),F$(72),S$(72),R$(72),P$(72),Z$(72)
110 DIM S(36),R(36),N(36): FOR J = 0 TO 8: READ HOW%(J):NEXT J
115 DATA 250,0,150,1,22000,50,10,0,0
120 N1=36:N2=12:N3=112:SAY A$,HOW%
130 FOR X=1 TO N1+N2+N3:READ Z$:NEXT X:REM SAME AS RESTORE
140 FOR X=1 TO N1
150 READ S(X),L:R(X)=S(X):N(X)=S(X)+L-1
160 NEXT X
170 PRINT "HELLO! I AM ELIZA. WHAT'S YOUR PROBLEM?":PRINT A$:A$= TRANSLATE$("HELLO! I AM EELI ZA. WHAT'S YOUR PROBLUM"):SAY A$,HOW%
180 REM
190 REM ------- USER INPUT SECTION----------
200 REM
210 LINE INPUT I$
220 I$=" "+I$+" " ' GET RID OF APOSTROPHES
230 FOR L=1 TO LEN(I$)
240 IF MID$(I$,L,1)="'" THEN I$=LEFT$(I$,L-1)+RIGHT$(I$,LEN(I$)-L):GOTO 240
250 IF L+4<=LEN(I$) THEN IF MID$(I$,L,4)="SHUT" THEN PRINT "SHUT UP....":A$= TRANSLATE$("SHUT UP!"):SAY A$,HOW%:END
260 NEXT L
270 IF I$=P$ THEN A$="PLEASE DON'T REPEAT YOURSELF!":PRINT A$:A$=TRANSLATE$ (A$):SAY A$,HOW%:GOTO 180
280 REM
290 REM --------FIND KEYWORD IN I$-----
300 REM
310 RESTORE
320 S=0
330 FOR K=1 TO N1
340 READ K$
350 IF S>0 THEN 390
360 FOR L=1 TO LEN(I$)-LEN(K$)+1
370 IF MID$(I$,L,LEN(K$))=K$ THEN S=K:T=L:F$=K$
380 NEXT L
390 NEXT K:IF S>0 THEN K=S:L=T:GOTO 420
400 K=36:GOTO 620:REM WE DIDN'T FIND ANY KEYWORDS
410 REM
420 REM TAKE RIGHT PART OF STRING AND CONJUGATE IT
430 REM USING THE LIST OF STRINGS TO BE SWAPPED
440 REM
450 RESTORE:FOR X=1 TO N1:READ Z$:NEXT X:REM SKIP OVER KEYWORDS
460 C$=" "+RIGHT$(I$,LEN(I$)-LEN(F$)-L+1)
470 FOR X=1 TO N2/2
480 READ S$,R$
490 FOR L=1 TO LEN(C$)
500 IF L+LEN(S$)=LEN(C$) THEN 550
510 IF MID$(C$,L,LEN(S$))<>S$ THEN 550
520 C$=LEFT$(C$,L-1)+R$+RIGHT$(C$,LEN(C$)-L-LEN(S$)+1)
530 L=L+LEN(R$)
540 GOTO 580
550 IF L+LEN(R$)>LEN(C$) THEN 580
560 IF MID$(C$,L,LEN(R$))<>R$ THEN 580
570 C$=LEFT$(C$,L-1)+S$+RIGHT$(C$,LEN(C$)-L-LEN(R$)+1)
580 NEXT L
590 NEXT X
600 IF MID$(C$,2,1)=" " THEN C$=RIGHT$(C$,LEN(C$)-1):REM ONLY 1 SPACE
610 REM
620 REM NOW USING THE KEYWORD NUMBER (K) GET REPLY
630 REM
640 RESTORE:FOR X=1 TO N1+N2:READ Z$:NEXT X
650 FOR X=1 TO R(K):READ F$:NEXT X:REM READ RIGHT REPLY
660 R(K)=R(K)+1:IF R(K)>N(K) THEN R(K)=S(K)
670 IF RIGHT$(F$,1)<>"*" THEN PRINT F$:P$=I$:SAY TRANSLATE$ (F$),HOW%:GOTO 180
680 A$= LEFT$(F$,LEN(F$)-1)+C$:PRINT A$:SAY TRANSLATE$(A$),HOW%
690 P$=I$:GOTO 180
700 REM
710 REM ---------PROGRAM DATA FOLLOWS----------
720 REM
730 REM KEYWORDS
740 REM
750 DATA "CAN YOU","CAN I","YOU ARE","YOURE","I DONT","I FEEL"
760 DATA "WHY DONT YOU","WHY CANT I","ARE YOU","I CANT","I AM","IM "
770 DATA "YOU ","I WANT","WHAT","HOW","WHO","WHERE","WHEN","WHY"
780 DATA "NAME","CAUSE","SORRY","DREAM","HELLO","HI ","MAYBE"
790 DATA "NO ","YOUR","ALWAYS","THINK","ALIKE","YES","FRIEND"
800 DATA "COMPUTER","NOKEYFOUND"
810 REM
820 REM STRING DATA FOR CONJUGATIONS
830 REM
840 DATA " ARE "," AM ","WERE ","WAS "," YOU "," I "," YOUR ","MY "
850 DATA " IVE "," YOURVE "," IM "," YOURE "
860 REM
870 REM REPLIES
880 REM
890 DATA "DON'T YOU BELIEVE THAT I CAN*"
900 DATA "PERHAPS YOU WOULD LIKE TO BE ABLE TO*"
910 DATA "YOU WANT ME TO BE ABLE TO*"
920 DATA "PERHAPS YOU DON'T WANT TO*"
930 DATA "DO YOU WANT TO BE ABLE TO*"
940 DATA "WHAT MAKES YOU THINK I AM*"
950 DATA "DOES IT PLEASE YOU TO BELIEVE I AM*"
960 DATA "PERHAPS YOU WOULD LIKE TO BE*"
970 DATA "DO YOU SOMETIMES WISH YOU WERE*"
980 DATA "DON'T YOU REALLY*"
990 DATA "WHY DON'T YOU*"
1000 DATA "DO YOU WISH TO BE ABLE TO*"
1010 DATA "DOES THAT TROUBLE YOU?"
1020 DATA "TELL ME MORE ABOUT SUCH FELLINGS."
1030 DATA "DO YOU OFTEN FEEL*"
1040 DATA "DO YOU ENJOY FEELING*"
1050 DATA "DO YOU REALLY BELIEVE I DON'T*"
1060 DATA "PERHAPS IN GOOD TIME I WILL*"
1070 DATA "DO YOU WANT ME TO*"
1080 DATA "DO YOU THINK YOU SHOULD BE ABLE TO*'
1090 DATA "WHY CAN'T YOU*"
1100 DATA "WHY ARE YOU INTERESTED IN WHETER OR NOT I AM*"
1110 DATA "WOULD YOU PREFER IF I WERE NOT*"
1120 DATA "PERHAPS IN YOUR FANTASIES I AM*"
1130 DATA "HOW DO YOU KNOW YOU CAN'T*"
1140 DATA "HAVE YOU TRIED?"
1150 DATA "PERHAPS YOU CAN NOW*"
1160 DATA "DID YOU COME TO ME BECAUSE YOU ARE*"
1170 DATA "HOW LONG HAVE YOU BEEN*"
1180 DATA "DO YOU BELIEVE IT IS NORMAL TO BE*"
1190 DATA "DO YOU ENJOY BEING*"
1200 DATA "WE WERE DISCUSSING YOU-- NOT ME."
1210 DATA "OH, I*"
1220 DATA "YOU'RE NOT REALLY TALKING ABOUT ME, ARE YOU?"
1230 DATA "WHAT WOULD IT MEAN TO YOU IF I GOT*"
1240 DATA "WHY DO YOU WANT*"
1250 DATA "SUPPOSE YOU SOON GOT*"
1260 DATA "WHAT IF YOU NEVER GOT*"
1270 DATA "I SOMETIMES ALSO WANT*"
1280 DATA "WHY DO YOU ASK?"
1290 DATA "DOES THAT QUESTION INTEREST YOU?"
1300 DATA "WHAT ANSWER WOULD PLEASE YOU THE MOST?"
1310 DATA "WHAT DO YOU THINK?"
1320 DATA "ARE SUCH QUESTIONS ON YOUR MIND OFTEN?"
1330 DATA "WHAT IS IT THAT YOU REALLY WHAT TO KNOW?"
1340 DATA "HAVE YOU ASKED ANYONE ELSE?"
1350 DATA "HAVE YOU ASKED SUCH QUESTIONS BEFORE?"
1360 DATA "WHAT ELSE COMES TO MIND WHEN YOU ASK THAT?"
1370 DATA "NAMES DON'T INTEREST ME."
1380 DATA "I DON'T CARE ABOUT NAMES-- PLEASE GO ON."
1390 DATA "IS THAT THE REAL REASON?"
1400 DATA "DON'T ANY OTHER REASONS COME TO MIND?"
1410 DATA "DOES THAT REASON EXPLAIN ANYTHING ELSE?"
1420 DATA "WHAT OTHER REASONS MIGHT THERE BE?"
1430 DATA "PLEASE DON'T APOLOGIZE!"
1440 DATA "APOLOGIES ARE NOT NECESSARY."
1450 DATA "WHAT FEELING DO YOU HAVE WHEN YOU APOLOGIZE?"
1460 DATA "DON'T BE SO DEFENSIVE!"
1470 DATA "WHAT DOES THAT DREAM SUGGEST TO YOU?"
1480 DATA "DO YOU DREAM OFTEN?"
1490 DATA "WHAT PERSONS APPEAR IN YOUR DREAMS?"
1500 DATA "ARE YOU DISTURBED BY YOUR DREAMS?"
1510 DATA "HOW DO YOU DO .... PLEASE STATE YOUR PROBLEM."
1520 DATA "YOU DON'T SEEM QUITE CERTAIN."
1530 DATA "WHY THE UNCERTAIN TONE?"
1540 DATA "CAN'T YOU BE MORE POSITIVE?"
1550 DATA "YOU AREN'T SURE?"
1560 DATA "DON'T YOU KNOW?"
1570 DATA "ARE YOU SAYING NO JUST TO BE NEGATIVE?"
1580 DATA "YOU ARE BEING A BIT NEGATIVE."
1590 DATA "WHY NOT?"
1600 DATA "ARE YOU SURE?"
1610 DATA "WHY NO?"
1620 DATA "WHY ARE YOU CONCERNED ABOUT MY*"
1630 DATA "WHAT ABOUT YOUR OWN*"
1640 DATA "CAN YOU THINK OF A SPECIFIC EXAMPLE?"
1650 DATA "WHEN?"
1660 DATA "WHAT ARE YOU THINKING OF?"
1670 DATA "REALLY, ALWAYS?"
1680 DATA "DO YOU REALLY THINK SO?"
1690 DATA "BUT YOU ARE NOT SURE YOU*"
1700 DATA "DO YOU DOUBT YOU*"
1710 DATA "IN WHAT WAY?"
1720 DATA "WHAT RESEMBLANCE DO YOU SEE?"
1730 DATA "WHAT DOES THE SIMILARITY SUGGEST TO YOU?"
1740 DATA "WHAT OTHER CONNECTIONS DO YOU SEE?"
1750 DATA "COULD THER REALLY BE SOME CONNECTION?"
1760 DATA "HOW?"
1770 DATA "YOU SEEM QUITE POSITIVE."
1780 DATA "ARE YOU SURE?"
1790 DATA "I SEE."
1800 DATA "I UNDERSTAND."
1810 DATA "WHY DO YOU BRING UP THE TOPIC OF FRIENDS?"
1820 DATA "DO YOUR FRIENDS WORRY YOU?"
1830 DATA "DO YOUR FRIENDS PICK ON YOU?"
1840 DATA "ARE YOU SURE YOU HAVE ANY FRIENDS?"
1850 DATA "DO YOU IMPOSE ON YOUR FRIENDS?"
1860 DATA "PERHAPS YOUR LOVE FOR FRIENDS WORRIES YOU."
1870 DATA "DO COMPUTERS WORRY YOU?"
1880 DATA "ARE YOU TALKING ABOUT ME IN PARTICULAR?"
1890 DATA "ARE YOU FRIGHTENED BY MACHINES?"
1900 DATA "WHY DO YOU MENTION COMPUTERS?"
1910 DATA "WHAT DO YOU THINK MACHINES HAVE TO DO WITH YOUR PROBLEM?"
1920 DATA "DON'T YOU THINK COMPUTERS CAN HELP PEOPLE?"
1930 DATA "WHAT IS IT ABOUT COMPUTER THAT WORRIES YOU?"
1940 DATA "SAY, DO YOU HAVE ANY PSYCHOLOGICAL PROBLEMS?"
1950 DATA "WHAT DOES THAT SUGGEST TO YOU?"
1960 DATA "I SEE."
1970 DATA "I'M NOT SURE I UNDERSTAND YOU FULLY."
1980 DATA "COME, COME, ELUCIDATE YOUR THOUGHTS."
1990 DATA "CAN YOU ELABORATE ON THAT?"
2000 DATA "THAT IS QUITE INTERESTING."
2010 REM
2020 REM DATA FOR FINDING RIGHT REPLIES
2030 REM
2040 DATA 1,3,4,2,6,4,6,4,10,4,14,3,17,3,20,2,22,3,25,3
2050 DATA 28,4,28,4,32,3,35,5,40,9,40,9,40,9,40,9,40,9,40,9
2060 DATA 49,2,51,4,55,4,59,4,63,1,63,1,64,5,69,5,74,2,76,4
2070 DATA 80,3,83,7,90,3,93,6,99,7,106,6
,9,40,9,40,9,40,9,40,9
2060 DATA 49,2,51,4,55,4,59,4,63,1,63,1,64,5,69,5,74,2,76,4